package com.alks.function.controller.pcFactoryQuery;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.factoryquery.CuttingPartSpRequest;
import com.alks.function.service.pcfactoryquery.IPcCuttingLsPartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@ApiRestController("/pcFactorQuery")
@Api(value = "总经办", tags = "总经办-工厂查询模块-裁配配套查询")
@Slf4j
@RoleCheck(prgIds = {"100416","140208","160214","110308","180714","190213","170513"})
public class CutPartSpController {
    @Autowired
    private IPcCuttingLsPartService cutService;

    @PutMapping("/queryCuttingPartSp")
    @ApiOperation(value = "冲裁配套状况-条件分页查询",tags = "总经办-工厂查询模块-裁配配套查询")
    @WebLogger
    public ResponseInfo queryCuttingPartSp(@RequestBody CuttingPartSpRequest request){return cutService.queryCuttingPartSpHead(request);}

    @GetMapping("/queryCuttingPartSpDetail/{lotNo}")
    @ApiOperation(value = "冲裁配套明细-条件查询",tags = "总经办-工厂查询模块-裁配配套查询")
    @WebLogger
    public ResponseInfo queryCuttingPartSpDetail(@PathVariable String lotNo){return cutService.queryCuttingPartSpDetail(lotNo);}

    @PostMapping("/queryCuttingByPart")
    @ApiOperation(value = "部位已制明细-条件查询",tags = "总经办-工厂查询模块-裁配配套查询")
    @WebLogger
    public ResponseInfo queryCuttingByPart(@RequestParam@ApiParam(required = true,value = "指令") String lotNo,
                                           @RequestParam@ApiParam(required = true,value = "制程") String processCode,
                                           @RequestParam@ApiParam(required = true,value = "号码") String sizeNo,
                                           @RequestParam(required = false)@ApiParam(value = "传1查未配套") Integer spFlag){
        return cutService.queryCuttingGropByPart(lotNo,processCode,sizeNo,spFlag);
    }

}
